#include "Timer.h"


Timer::Timer(int init_count, float init_interval,Dispatch* dispatchx)
{
	dispatch = dispatchx;
	count = init_count;
	interval = init_interval;
}

Timer::~Timer(void)
{
}

void Timer::Action(void)
{
	//
	//Sends the event to dispatch
	//
	dispatch->dispatchTimerPulse();
	
}

void Timer::pulse() //Act and 
{
	if (this->IsStopped() != true)
	{
		count++;
		Action();
	}
}

void Timer::resetCount()
{
	count = 0;
}

void Timer::halt()
{
	timer_halt = true;
}

void Timer::resume()
{
	timer_halt = false;
}

bool Timer::IsStopped()
{
	return timer_halt;
}

float Timer::getInterval(){return interval;}